function addShopCar(obj) {
	var shopcartStr = $.cookie("shopcartStr");
	var flag = false;
	var shopcar;
	var row = obj.parentNode.parentNode;
	var col = row.cells;
	var nmcid = col[0].firstChild.value;
	if (shopcartStr == null) {
		shopcartStr = "[]";
	}
	if (shopcartStr != "[]") {
		shopcar = JSON.parse(shopcartStr);
		for ( var i in shopcar) {
			var item = shopcar[i];
			if (nmcid == item.nid) {
				item.count += 1;
				flag = true;
			}
		}
	}
	if (!flag) {
		var mcBean1 = {
			"nid" : nmcid,
			"count" : 1
		};
		var shopcar = eval("(" + shopcartStr + ")");
		shopcar.push(mcBean1);
	}
	$.cookie("shopcartStr", JSON.stringify(shopcar), {
		expires : 7,
		path : "/"
	});
}
function minusCar(obj) {
	var shopcartStr = $.cookie("shopcartStr");
	var shopcar;
	var row = obj.parentNode.parentNode;
	var rols = row.cells;
	var col = obj.parentNode;
	var nmcid = col.firstChild.value;
	shopcar = JSON.parse(shopcartStr);
	for ( var i in shopcar) {
		var item = shopcar[i];
		if (nmcid == item.nid) {
			item.count -= 1;
			var nprice = rols[2].childNodes[1].innerHTML;
			var totalCountTag = document.getElementById("totalCount");
			var totalNpriceTag = document.getElementById("totalNprice");
			var distotalNpriceTag = document.getElementById("distotalNprice");
			var totalNprice = totalNpriceTag.innerHTML;
			
			var totalCount = totalCountTag.innerHTML;
			if (item.count != 0) {
				document.getElementById("count" + nmcid).value = item.count;
				rols[4].childNodes[1].innerHTML = (item.count * nprice)
						.toFixed(2);
			} else {
				shopcar.splice(i, 1);
				row.parentNode.removeChild(row);
				distotalNpriceTag.innerHTML = 0.0;
			}
			totalCountTag.innerHTML -= 1;
			totalNpriceTag.innerHTML = (totalNprice - nprice).toFixed(2);
			if (totalCount - 1 > 2) {
				distotalNpriceTag.innerHTML =( (totalNprice - nprice)* 0.95).toFixed(2) ;
			}else{
				distotalNpriceTag.innerHTML = (totalNprice - nprice).toFixed(2);
			}
		}
	}
	$.cookie("shopcartStr", JSON.stringify(shopcar), {
		expires : 7,
		path : "/"
	});
}
function plusCar(obj) {
	var shopcartStr = $.cookie("shopcartStr");
	var shopcar;
	var row = obj.parentNode.parentNode;
	var rols = row.cells;
	var col = obj.parentNode;
	var nmcid = col.firstChild.value;
	shopcar = JSON.parse(shopcartStr);
	for ( var i in shopcar) {
		var item = shopcar[i];
		if (nmcid == item.nid) {
			item.count += 1;
			document.getElementById("count" + nmcid).value = item.count;
			var nprice = rols[2].childNodes[1].innerHTML;
			rols[4].childNodes[1].innerHTML = (item.count * nprice).toFixed(2);
			var totalCountTag = document.getElementById("totalCount");
			var totalCount = totalCountTag.innerHTML;
			totalCountTag.innerHTML++;
			var totalNpriceTag = document.getElementById("totalNprice");
			var totalNprice = totalNpriceTag.innerHTML;
			var distotalNpriceTag = document.getElementById("distotalNprice");
			totalNpriceTag.innerHTML = parseInt(
					parseInt(totalNprice) + parseInt(nprice)).toFixed(2);
			if (totalCount + 1 > 2) {
				distotalNpriceTag.innerHTML = (parseInt(
						parseInt(totalNprice) + parseInt(nprice))* 0.95).toFixed(2) ;
			}else{
				distotalNpriceTag.innerHTML = parseInt(
						parseInt(totalNprice) + parseInt(nprice)).toFixed(2);
			}
		}
	}
	$.cookie("shopcartStr", JSON.stringify(shopcar), {
		expires : 7,
		path : "/"
	});
}